package day03;

import java.sql.SQLOutput;

//运算符的演示
public class Operdemo {
    public static void main(String[] args) {

//        int a = 5 , b = 5;
//        a++;
//        ++b;
//        System.out.println(a);
//        System.out.println(b);


 /*


        int a = 9 ,b = 11;
        int c = a++;
        int d = ++b;

        System.out.println(a);//10
        System.out.println(b);//12
        System.out.println(c);//9
        System.out.println(d);//12


 */
/*
        int a = 85 ,b = 74;
        int c = a--;
        int d = --b;

        System.out.println(a);//84
        System.out.println(b);//73
        System.out.println(c);//85
        System.out.println(d);//73
*/


/*


        int a = 7, b = 8  ,c = 9;
        boolean b1 = a>b;
        System.out.println(b1);//flase
        System.out.println(c<b);//false
        System.out.println(a>=c);//false
        System.out.println(a<=b);//ture
        System.out.println(a==c);//false
        System.out.println(a!=c);//ture
        System.out.println(a%2==0);//flase
        System.out.println(a+c>b);//ture
        System.out.println(a-->7);//false
        System.out.println(a++>7);//ture


 */

/*


        int a = 5, b = 10, c = 5;
        boolean b1 = b >= a && b < c;
        System.out.println(b1);//false
        System.out.println(b <= c && b > a);//flase
        System.out.println(a == b && b < a);//flase
        System.out.println(b != c && b > a); //true

        int age = 88;
        System.out.println(age >= 18 && age <= 58); // ture&&false      flase
        int score = 54;
        System.out.println(score >= 0 && score <= 100); //ture &&ture   ture


        int aa = 60;
        if (aa > 70) {
            System.out.println("真");
        } else {
            System.out.println("假");
        }
        ;

 */


        /*


        int a = 5, b = 10, c = 5;
        System.out.println(b >= a || b < c);
        System.out.println(b <= c || b < a);
        System.out.println(b != c || b > a);
        System.out.println(a == b || b < a);
        int score = 90;
        System.out.println(score < 0 || score > 100);
        boolean b2 = !(a < b);
        System.out.println(b2);
        System.out.println(!(a > b));
      */

        /*


        int a = 5, b = 10, c = 5;
        boolean b3 = a>b && c++>2;
        System.out.println(b3);
        System.out.println(c);

        boolean b4;
        System.out.println();
        System.out.println();
         */


        /*
        1) 简单赋值运算符:=
        2) 扩展赋值运算符: +=, -= , *=,/= ,%=,    ---------扩展赋值运算自带强转功能
         */
/*


        int a = 5;
        a += 10;
        System.out.println(a);
        a *= 2;
        System.out.println(a);
        a /= 6;
        System.out.println(a);
        //小面试题:
        short s = 5;
        //s = s+10;//编译错误,需强转,改为 s = (short)(s +10 );
        s += 10;//s = (short)(s +10 );


 */


         /*
         5.字符串连接运算符
         1)+:
            1.1)若两边都是数字,则做加法运算
            1.2)若两边出现了字符串,则做字符串连接
                    ----任何类型的数据与字符串项相连,结果都会变为字符串类型
          */

/*
        System.out.println(10+20+""+30); //3030----------String
        System.out.println(""+10+20+30); //102030--------String
        System.out.println(10+20+30+""); //60------------String
*/
        /*


        int age = 88;
        System.out.println("age=");
        System.out.println(age);
        System.out.println("age="+age);
        System.out.println("我今年" + age+ "岁了");
        String name = "cjf";
        System.out.println("大家好,我叫" + name);
        System.out.println("大家好,我叫" + name + "今年" + age + "岁了");

    */


/*
条件运算符
        1)语法
        booleam?数1:数2
        2)执行过程
            整个表达式是有值的,他的值要么是?后面的数,要么是:后面的数2
            计算booleam的值:
                若为true,则整个表达式的值为?后面的数1
                若为false,则整个表达式的值为:号后的数2
 */

/*


        int unm = 5;
        int flag = unm > 0?1:-1;
        System.out.println(flag);


        int a = 8, b = 5;
        int max = a>b?a:b;
        System.out.println("max=" + max);

         */





















    }

}






























































